//
//  FKHttpTool.h
//  FKLibraryExample
//
//  Created by frank on 2018/8/13.
//  Copyright © 2018年 zmosa - frank. All rights reserved.
//

#import "FKBaseResult.h"

@interface FKHttpTool : NSObject

/** 用原生的方法传输json格式的数据 */
+ (void)postJsonWithSuffix:(NSString *)suffix param:(id)param success:(void (^)(FKBaseResult *result))success failure:(void (^)(NSError *error))failure;

/** 比较通用的调用方法 */
+ (void)postWithSuffix:(NSString *)suffix param:(id)param success:(void (^)(FKBaseResult *result))success failure:(void (^)(NSError *error))failure;


+ (void)getWithSuffix:(NSString *)suffix param:(id)param success:(void (^)(FKBaseResult *result))success failure:(void (^)(NSError *error))failure;


/** 上传视频 **/
+ (void)uploadVideo:(NSURL *)localUrl progress:(void (^)(NSProgress *progress))progress success:(void (^)(FKBaseResult *result))success failure:(void (^)(NSError *error))failure;
/** 上传音频 */
+ (void)uploadAudio:(NSURL *)localUrl progress:(void (^)(NSProgress *progress))progress success:(void (^)(FKBaseResult *result))success failure:(void (^)(NSError *error))failure;
/** 上传文件[word,pdf] */
+ (void)uploadFile:(NSURL *)localUrl progress:(void (^)(NSProgress *progress))progress success:(void (^)(FKBaseResult *result))success failure:(void (^)(NSError *error))failure;

/** 上传图片 */
+ (void)uploadFile:(NSString *)suffix param:(id)param files:(NSDictionary *)files progress:(void (^)(NSProgress *progress))progress success:(void (^)(FKBaseResult *result))success failure:(void (^)(NSError *error))failure;
/** 上传图片，将请求的URL封装起来了 */
+ (void)uploadImages:(NSArray *)images complete:(void(^)(NSString *attachsStr, NSError *error))complete;


/** 下载文件 */
+ (NSURLSessionDownloadTask *)downloadFile:(NSString *)suffix saveUrl:(NSURL *)saveUrl progress:(void (^)(NSProgress *progress))progress success:(void (^)(FKBaseResult *result))success failure:(void (^)(NSError *error))failure;

@end
